﻿using System;

class VersionInAction
{
    [Version("0.1", "Sums Numbers")]
    public static void CalculateSum(int a, int b)
    {
        int c = a + b;
    }

    [Version("fist version", "Proving That Deletion With Zero Is Possible")]                                     
    public static void DeleteWithZero(int a)
    {
        double c = a / 1;
    }

    [Version("4.3")]
    public static void Main()
    {
        Type type = typeof(VersionInAction);
        var methods = type.GetMethods();
        foreach (var method in methods)
        {
            Type typeOfAttribute = typeof(VersionAttribute);
            var attributes = method.GetCustomAttributes(typeOfAttribute, false);
            foreach (var attribute in attributes)
            {
                VersionAttribute methodAttribute = (VersionAttribute) attribute;
                Console.WriteLine("{0} has version {1} and comment {2}", 
                                  method.Name,
                                  methodAttribute.VersionName,
                                  methodAttribute.Comment); 
            }
        }
    }
}